//父类
class Person {
  //成员属性
  name;
  age;

  constructor(name, age) {
    this.name = name;
    this.age = age;
    console.log(this,"111")
  }

  //成员方法
  say() {
    return `我是${this.name}，我今年${this.age}岁`;
  }
}

// let p1 = new Person("张三", 21);
// console.log(p)

//子类继承父类
class Student extends Person {
  score;
  constructor(name, age, score) {
    // super();
    // this.name = name;
    // this.age = age;

    super(name, age);
    this.score = score;
    // console.log(this,"222")
  }

  say() {
    return `我是${this.name}，我喜欢编程`;
  }

  study() {
    return `我是${this.name}，我喜欢学习`;
  }
}

let s1 = new Student("小红", 21, 100);
// console.log(s1);
